﻿using System.Windows;
using System.Windows.Controls.WpfPropertyGrid;
using Microsoft.Win32;
using devtm.Editor.Configuration.MyEditors;

namespace devtm.Editor.Configuration.CustomTypeEditors
{
  // TODO: Refactoring needed!
  //  public class FileBrowserDialogPropertyValueEditor : System.Windows.Controls.WpfPropertyGrid.Editor
  //{
  //  public FileBrowserDialogPropertyValueEditor()
  //  {
  //      InlineTemplate = EditorKeys.FileBrowserEditorKey;
  //  }

  //  public override void ShowDialog(PropertyItemValue propertyValue, IInputElement commandSource)
  //  {
  //    if (propertyValue == null) return;
  //    if (propertyValue.ParentProperty.IsReadOnly) return;

  //    var ofd = new OpenFileDialog();
  //    ofd.Multiselect = false;

  //    var property = propertyValue.ParentProperty;
  //    if (property != null)
  //    {
  //      var optionsAttribute = (OpenFileDialogOptionsAttribute)property.Attributes[typeof(OpenFileDialogOptionsAttribute)];
  //      if (optionsAttribute != null)
  //        optionsAttribute.ConfigureDialog(ofd);
  //    }

  //    if (ofd.ShowDialog() == true)
  //      propertyValue.StringValue = ofd.FileName;
  //  }
  //}
}
